package com.wbt.bambootown.mvp.presenter;


import com.wbt.bambootown.mvp.contract.LoginContract;
import com.wbt.bambootown.mvp.frame.ActivityPresenter;
import com.wbt.bambootown.mvp.model.LoginModel;
import com.wbt.bambootown.rx.FilterSubscriber;

public class LoginPresenter extends ActivityPresenter<LoginModel,LoginContract.View> implements LoginContract.Presenter{
    public static final String TAG = "LoginPresenter";

    @Override
    public void login(String username, String password) {
        addSubscriptionForUser(getModel().login(username, password), new FilterSubscriber() {
            @Override
            public void onError(int errorCode, String errorMsg) {
                getView().showError(errorMsg);
            }

            @Override
            public void onNext(Object o) {
                getView().showLoginSuccess();
            }
        });
    }
}
